
// 卡面状态
export const typeStatus = [
  {
    name: '启用',
    value: '1'
  },
  {
    name: '停用',
    value: '2'
  }
]

// 主页面 table
export const columns = context => {
  return [
    {
      prop: 'name',
      label: '卡面名称'
    },
    {
      prop: 'image',
      label: '卡面图片',
      minWidth: 120,
      toolTip: false,
      render: (h, row) => {
        return [
          <img src={row.image} style="width: 100px; height: 100px; object-fit: contain;" />
        ]
      }
    },
    {
      label: '状态',
      minWidth: 120,
      toolTip: false,
      render: (h, row) => {
        return [
          <zm-switch
            value={row.status}
            active-value="1"
            inactive-value="2"
            onChange={() => context.onSwitch(row)}
          />
        ]
      }
    },
    {
      prop: 'updateTime',
      label: '更新日期'
    },
    {
      label: '操作',
      width: 200,
      render: (h, row) => {
        const edit = (
          <a
            href="javascript:;"
            class="text-primary"
            onClick={() => {
              context.onEdit(row)
            }}
          >
            编辑
          </a>
        )
        const del = (
          <a
            href="javascript:;"
            class="text-error"
            onClick={() => {
              context.onDel(row)
            }}
          >
            删除
          </a>
        )
        return [edit, del]
      }
    }
  ]
}
